package red.lightblue.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import red.lightblue.admin.dao.ProductTypeDAO;
import red.lightblue.admin.dao.TypeDAO;
import red.lightblue.admin.model.Type;
import tech.ideashare.utils.is_generate.IS_GenModelUtils;

/**
 * @Author lixiang
 * @CreateTime 01/04/2018
 **/
@RestController
@RequestMapping("debug")
public class DebugController {

    @Autowired
    private ProductTypeDAO productTypeDAO ;

    @Autowired
    private TypeDAO typeDao;


    @GetMapping("initProductType")
    public String initProductType() throws InstantiationException, IllegalAccessException {
        Type type = (Type) IS_GenModelUtils.generate_model(Type.class);
        type.setId(null);
        type.setParentTypeId(1);

        typeDao.insertType(type);
        return "";
    }

}
